class SoundManager {
  
  static SoundManager _instance = null;
  
  DOM.AudioContext _audioContext;
  DOM.AudioGain _gain;
  HashMap<String, DOM.ArrayBuffer> _loadedAudioBuffers;
  
  SoundManager._getInstance()
  {
    _audioContext = new DOM.AudioContext();
    _loadedAudioBuffers = new HashMap<String, DOM.ArrayBuffer>();
  }
  
  factory SoundManager()
  {
    if(_instance == null)
    {
      _instance = new SoundManager._getInstance();
    }
    
    return _instance;
  }
  
  DOM.AudioContext get context()
  {
    return _audioContext;
  }
  
  bool containsBuffer(String src)
  {
    return _loadedAudioBuffers.containsKey(src);
  }
  
  DOM.ArrayBuffer getBuffer(String src)
  {
    if(containsBuffer(src))
    {
      return _loadedAudioBuffers[src];
    }
    
    else return null;
  }
  
  void addBuffer(String src, DOM.ArrayBuffer buffer)
  {
    _loadedAudioBuffers[src] = buffer;
  }
  
}
